<template>

  <view class="content">
    <view class="header_txt">
      <view class="back"
            @click="goback">
        <image src="/static/img/back3.png"></image>
      </view>
      <view class="title"> 名企详情 </view>
    </view>

    <block v-for="el in List"
           :key="el.id">
      <view class="top_time">{{el.createtime}}</view>
      <block v-if="false">
        <view class="left_box">
          <image src=""
                 mode=""></image>
          <view class="left_jt"></view>
          <view class="left_chat_con">{{}}</view>
        </view>
      </block>
      <block>
        <view class="right_box">
          <view class="right_chat_c">{{el.question}}</view>
          <view class="right_jt"></view>
          <image :src="$serverIp+el.user.avatar"
                 mode=""></image>
        </view>
      </block>
    </block>
    <view class="btm_box">
      <input type="text"
             value=""
             v-model="msg"
             placeholder="我来说两句"
             placeholder-class="input_class" />
      <view @click="save"
            class="btm_btn">发送</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      id: '',
      List: [],
      msg: ''
    }
  },
  async onLoad(e) {
    this.id = e.id
    let { data } = await this.$http.post('/company/question_list', { c_id: this.id, page: 1, pageSize: 100 })
    this.List = data.data
  },
  methods: {
    async getList() {
      let { data } = await this.$http.post('/company/question_list', { c_id: this.id, page: 1, pageSize: 100 })
      this.List = data.data
    },
    async save() {
      let { data } = await this.$http.post('/company/question', { question: this.msg, c_id: this.id })
      uni.showToast({
        title: data.msg,
        icon: 'none'
      })
      this.getList()
      this.msg = ''
    }
  }
}
</script>

<style lang="scss">
.header_txt {
  width: 750rpx;
  overflow: hidden;
  height: 88rpx;
  background-color: #fff;

  .back {
    position: absolute;
    top: 14rpx;
    left: 14rpx;
    width: 60rpx;
    height: 60rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    image {
      width: 48rpx;
      height: 48rpx;
    }
  }

  /* // .right {
  //   position: absolute;
  //   top: 14rpx;
  //   right: 14rpx;
  //   width: 60rpx;
  //   height: 60rpx;
  //   display: flex;
  //   justify-content: center;
  //   align-items: center;
  // } */

  .title {
    width: 750rpx;
    text-align: center;
    height: 88rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    font-weight: bold;
  }
}
.content {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 0 30rpx;
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 0 15px;
}
.top_time {
  width: 100%;
  height: 97rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
}
.left_box {
  width: 100%;
  min-height: 80rpx;
  margin-bottom: 50rpx;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.right_box {
  width: 100%;
  min-height: 80rpx;
  margin-bottom: 50rpx;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 40px;
  margin-bottom: 25px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
  justify-content: flex-end;
  overflow: hidden;
}
.left_box image {
  width: 76rpx;
  height: 76rpx;
  margin-right: 20rpx;
  background-color: #ffffff;
  border-radius: 50%;
}
.right_box image {
  width: 76rpx;
  height: 76rpx;
  margin-left: 20rpx;
  background-color: #ffffff;
  border-radius: 50%;
}
.left_chat_con {
  min-height: 75rpx;
  max-width: 402rpx;
  border-radius: 20rpx;
  background-color: #ffffff;
  padding: 20rpx 30rpx;
  display: flex;
  align-items: center;
}
.right_chat_c {
  min-height: 75rpx;
  max-width: 402rpx;
  border-radius: 20rpx;
  background-color: #fff9df;
  padding: 20rpx 30rpx;
  display: flex;
  align-items: center;
}
.left_jt {
  border-top: 10rpx solid transparent;
  border-right: 15rpx solid #ffffff;
  border-bottom: 10rpx solid transparent;
}
.right_jt {
  border-top: 10rpx solid transparent;
  border-left: 15rpx solid #fff9df;
  border-bottom: 10rpx solid transparent;
}
.btm_box {
  width: 92%;
  height: 76rpx;
  position: absolute;
  bottom: 1.5%;
  left: 4%;
  background-color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 92%;
  height: 38px;
  position: absolute;
  bottom: 1.5%;
  left: 4%;
  background-color: #fff;
  border-radius: 10px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  position: fixed;
}
.input_class {
  font-size: 30rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
}
input {
  margin-left: 40rpx;
  font-size: 30rpx;
}
.btm_btn {
  width: 200rpx;
  height: 76rpx;
  background: linear-gradient(126deg, #ffdd47, #fcb630);
  border-radius: 10rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #ffffff;
}
</style>
